]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
popupMenu: Force submenu arrow rotation angles to multiples of 90
authorHashem Nasarat <hashem@riseup.net>
Fri, 25 Apr 2014 05:09:39 +0000 (01:09 -0400)
committerBastien Nocera <hadess@hadess.net>
Wed, 3 Sep 2014 15:50:03 +0000 (17:50 +0200)
When you open or close a PopupSubMenu the arrow icon rotates, but
the code previously assumed that the starting angle was a multiple
of 90.  If you click the submenu fast enough the rotation could overlap
with the previous rotation and you'd get something that wasn't a multiple
of 90.
Now we ensure that the ending arrowRotation angle is always a multiple
of 90 regardless of what the starting angle is.

https://bugzilla.gnome.org/show_bug.cgi?id=728927

js/ui/popupMenu.js

index 1694e0a04f496bbc6c147742e9437c5c87cc27c9..be8bbe9d9a2fc9451cbedd2da5b042e263191d23 100644 (file)
@@ -922,8 +922,10 @@ const PopupSubMenu = new Lang.Class({
             let [minHeight, naturalHeight] = this.actor.get_preferred_height(-1);
             this.actor.height = 0;
             this.actor._arrowRotation = this._arrow.rotation_angle_z;
+            let angle = this.actor._arrowRotation;
+            // animate to the first multiple of 90 greater than current angle
             Tweener.addTween(this.actor,
-                             { _arrowRotation: this.actor._arrowRotation + 90,
+                             { _arrowRotation: angle - angle % 90 + 90,
                                height: naturalHeight,
                                time: 0.25,
                                onUpdateScope: this,
@@ -955,8 +957,10 @@ const PopupSubMenu = new Lang.Class({
 
         if (animate) {
             this.actor._arrowRotation = this._arrow.rotation_angle_z;
+            let angle = this.actor._arrowRotation;
+            // animate to the first multiple of 90 less than current angle
             Tweener.addTween(this.actor,
-                             { _arrowRotation: this.actor._arrowRotation - 90,
+                             { _arrowRotation: (angle - 1) - (angle - 1) % 90,
                                height: 0,
                                time: 0.25,
                                onUpdateScope: this,